package com.lbloca.locate.biz;

import com.lbloca.locate.beans.UserBean;
import com.lbloca.locate.utils.GsonUtil;
import com.lbloca.locate.utils.SPUtils;

public class UserBiz {
    private static UserBiz instance;

    public static UserBiz getInstance() {
        if (instance == null)
            instance = new UserBiz();
        return instance;
    }

    public String getUid() {
        return SPUtils.getInstance().getInt(Config.SPF_UID, 0) + "";
    }

    public void setUserInfo(String info) {
        SPUtils.getInstance().put(Config.SPF_USERINFO, info);
        SPUtils.getInstance().put(Config.SPF_UID, GsonUtil.json2Bean(info, UserBean.class).getId());
    }

    public UserBean getUserInfo() {
        return GsonUtil.json2Bean(SPUtils.getInstance().getString(Config.SPF_USERINFO), UserBean.class);
    }
}
